{include file="public/toper" /}
<div class="x-nav">
    <span class="layui-breadcrumb">
        <a href="">统计管理</a>
        <a><cite>共享订单统计</cite></a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right" href="javascript:location.replace(location.href);" title="刷新"><i class="layui-icon" style="line-height:30px">&#xe666;</i></a>
</div>
<div class="x-body">
    <div class="layui-row">
        <div class="layui-form layui-col-md12 x-so">
            <input type="text" name="sreach" value=""  style="width:250px;" id="key"   placeholder="用户/手机号/订单号/门店" autocomplete="off" class="layui-input">
            <input type="text" name="sreach" value=""  style="width:300px;" id="sj"   placeholder="时间" readonly="readonly" autocomplete="off" class="layui-input">
            <div class="layui-input-inline">
                <select name="type" id="type">
                    <option value=".">全部</option>
                    <option value="10">待归还</option>
                    <option value="5">归还中</option>
                    <option value="6">已归还</option>
                </select>
            </div>
            <button class="layui-btn" id="search"><i class="layui-icon">&#xe615;</i></button>
        </div>
    </div>
    <xblock class="demoTable">
        <!--<span class="layui-btn" ><a href="{:url('Stati/index1')}" style="color: #fff">平台订单统计</a></span>-->
        <span class="layui-btn" ><a href="{:url('Stati/index2')}" style="color: #fff">分销佣金统计</a></span>
        <!--<span class="layui-btn" ><a href="{:url('Stati/index4')}" style="color: #fff">分类共享统计</a></span>-->
        <!--<span class="layui-btn" ><a href="{:url('Stati/index5')}" style="color: #fff">共享押金统计</a></span>-->
        <span class="layui-btn" ><a href="{:url('Stati/index6')}" style="color: #fff">会员卡购买统计</a></span>
    </xblock>
    <table class="layui-hide" id="test" lay-filter="test"></table>
</div>
<script type="text/html" id="user">
    {{d.uname}}{{#  if(d.phone!=null){ }}【{{d.phone.substring(0,3)+"****"+d.phone.substring(7,d.phone.length) }}】{{#  } }}
</script>
<script type="text/html" id="goods">
    {{#  layui.each(d.goods, function(index, item){ }}
    <li>
        <span>{{ item.name }} * {{ item.goods_number}}</span>
    </li>
    {{#  }); }}
</script>
<script type="text/html" id="sn">
    <div><a href="#"  onclick="x_admin_show('查看订单','{:url(\'Order/order_details\')}?id={{d.order_id}}')" title="查看详情" class="layui-table-link">{{d.order_sn}}</a></div>
</script>
<script>
    layui.use(['table','util','layer','laydate'], function(){
        var table = layui.table, $ = layui.jquery;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var loading = layer.load(1, {shade: [0.1,'#fff'] });
        var tableIn = table.render({
            method: 'post',
            elem: '#test'
            ,url: "{:url('Stati/index3')}"
            ,id:'test'
            ,cols: [[
                {field:'order_id', width:80, title: '序号',align: 'center',type:'numbers'}
                ,{width:190, title: '订单号',align: 'center',totalRowText:'合计',templet:'#sn'}
                ,{width: 200,title: '用户', align: 'center', toolbar: '#user'}
                ,{field:'stname',width:150,title: '门店',align: 'center'}
                ,{width:150,title: '商品信息',align: 'center',templet:'#goods'}
                ,{field:'goods_price',width: 100,title: '订单金额', align: 'center',totalRow: true}
                ,{field:'pay_price',width: 100,title: '支付金额', align: 'center',totalRow: true}
                ,{field:'abrasion_price',width: 100,title: '逾期/磨损', align: 'center',totalRow: true}
                ,{field:'order_status', width:100, title: '状态',align: 'center'}
                ,{field:'add_time', width:180, title: '下单时间',align: 'center',templet: '<div>{{layui.util.toDateString(d.add_time*1000)}}</div>'}
                ,{field:'end_time', width:180, title: '完成时间',align: 'center',templet: '<div>{{layui.util.toDateString(d.end_time*1000)}}</div>'}
            ]]
            ,page:true
            ,limit: 30
            ,limits:[30,60,90,120,150,180,210,240,270,300]
            ,totalRow:true
        });
        layer.close(loading);

        laydate.render({
            elem: '#sj'
            ,type: 'datetime'
            ,range: true
        });


        $('#search').on('click', function () {
            tableIn.reload({
                where: {key: $('#key').val(),sj:$('#sj').val(),type:$('#type').val()}
                ,page: {curr: 1 }
            });
        });
    });
</script>
{include file="public/footer"/}